package com.xvdong.gadget.appium;

import java.net.URL;

import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.options.BaseOptions;

/**
 * Created by xvDong on 2025/6/19.
 */

public class AppFZJ600A extends BaseApp{

    public AppFZJ600A() {
        AppPackageName = "net.cnydl.flipmirrorsixzza.device";
        connect();
    }

    private AndroidDriver connect() {
        try {
            BaseOptions options = new BaseOptions()
                    .setPlatformName("Android") // 必填：平台类型
                    .setAutomationName("UIAutomator2")// 必填：驱动类型
                    .setPlatformVersion("7.1.1")
                    .amend("deviceName", "A40i-CORE-A40i")
                    .amend("appPackage", AppPackageName)
                    .amend("appActivity", AppPackageName + ".StartEmptyActivity")
                    .amend("noReset", true); // ✅ 添加此项：不要卸载重装 App
            URL url = new URL("http://localhost:4723/wd/hub");
            mDriver = new AndroidDriver(url, options);
            mDriver.getPageSource();
            Thread.sleep(3000);
            return mDriver;
        } catch (Exception e) {
            System.err.println("连接失败: " + e.getMessage());
        }
        return null;
    }

    public void  startTest(){
        shopTest("imageview5");
        userTest("imageview3");
        settingsTest("imageview4");
        detectionTest("imageview1");
        trainTest("imageview2");
    }
}
